Delphi MKV Tag Library
MKV Tag Library is a tag reader-writer component for Delphi (Win32, Win64) and a standalone DLL (any developer environment supporting the usage of DLLs) and COM class for Matroska container files (MKV, MKA, MKS, MK3D) based on mkvtoolnix.
Features:
- Loading of matroska tags
- Saving of matroska tags
- Loading of matroska chapters
- Manage cover arts
- Native Delphi unit, standalone DLL and in COM class version
- Fully unicode
Other tagging libraries:
MKV Tag Library in shareware and commercial software?
If you like the component and use it in a freeware, shareware or commercial (or any other money making - advertising, in app. selling, etc.) product you should buy a license.
There is a discount when purchasing MKV Tag Library license and ID3v2 Library and/or APEv2 Library and/or Ogg Vorbis and Opus Tag Library and/or Flac Tag Library and/or WMA Tag Library and/or MP4 Tag Library and/or WAV Tag Library together. Please checkmark the ID3v2 Library and/or APEv2 Library and/or Ogg Vorbis and Opus Tag Library and/or Flac Tag Library and/or WMA Tag Library and/or MP4 Tag Library and/or WAV Tag Library on the order page when purchasing MKV Tag Library license to get the other 7 component at 50% discount.
Requirements
- Delphi XE2 or above for the Delphi unit
- Developer environment supporting the usage of DLLs
- Developer environment supporting the usage of COM classes
Installation
Delphi: To Uses list add: MKVTagLibrary, and add the path to MKVTagLibrary.pas to the search path.
Copy all the files/folders from the mkvtoolnix package beside your .exe (Win32 or Win64 version respectively).
The COM class needs to be registered manually if you wish to use the COM class version.
Run an elevated command prompt, change dir into the folder where 'MKVTagCOM.dll' is located and run the following: "regsvr32 MKVTagCOM.dll". This should register the COM class. Do this for the desired Win32 and/or Win64 version.
To use the library in VBScript, on a 64 bit OS, the VBScript process is 64 bit so the needed 'MKVTagCOM.dll' has to be from the Win64 folder, beside the .VBS file or in the System32 folder.
When you distribute your app. the COM classes must be registered too on the user's computer.
Inno setup example:
[Files]
Source: "E:\MKV Tag Library\Setup files\Bin\Win32\MKVTagCOM.dll"; DestDir: "{app}\Bin\Win32"; Flags: regserver 32bit
Source: "E:\MKV Tag Library\Setup files\Bin\Win64\MKVTagCOM.dll"; DestDir: "{app}\Bin\Win64"; Flags: regserver 64bit; Check: IsWin64
Using the DLL version
The DLL version can be used in any language that supports calling DLL functions.
- 0. For non-Delphi load the DLL with InitMKVTagLibrary(), Delphi unit does this automatically
- 1. Set the path and file names to the MKVToolNix EXE files
- 2. Create an instance
- 3. Load the tags
- 5. Parse or edit the tags
- 5. Optionally save the changes
- 6. Free the instance
- 7. For non-Delphi unload the DLL with FreeMKVTagLibrary(), Delphi unit does this automatically
Please see the Tutorial DLL for details.
MKVTag_Load() parameters 'LoadCoverArts', 'LoadChapters' and 'GetMediaInfo' can be set to 'False' if they are not needed to speed up the loading process.
The DLL version works in 'context mode', the default target type is '50', so all GetTag()/SetTag() etc. functions will return and set the target type '50' tags. Use MKVTag_SetTargetTypeContext(PChar('70')) for example to work with tags of target type '70'.
To access lower level tags use the MKVTag_FindNode() and use the returned value with MKVTag_SetNodeContext() to set the context to work on that level of the branches (GetTag()/SetTag() etc. functions will then work on that level), call MKVTag_SetNodeContext(nil) to re-set and work on the root branch (default). You can get the complete tags XML with MKVTag_GetTagsXML() to see the levels.
MKVTag_GetInfoText() only returns the info if MKVTag_Load() was called with GetMediaInfo = True.
When saving (changing) cover arts (MKVTag_Save() 'SaveCoverArts = True') leaving a cover art file name empty ('') in MKVTag_SetCovers() will preserve that type existing cover art in destinaiton file, use MKVTL_DELETE_COVER_ART (or string value of "MKVTL_DELETE_COVER_ART") for the specific cover art's file name to delete that particular cover art.
Note: the returned pointers to strings (PChar strings) are only valid until the instance is valid or the specific tag is not deleted or new tags are loaded, so make a copy of the returned strings if they are needed afterwards.
Note: do not re-use the instance, free it and create a new one for loading other new MKV tags.
Note: chapters are supported for loading and parsing/editing tags only.
Using the COM class version
After registering the COM class DLL ('MKVTagCOM.dll') it can be accessed like (VBScript example):
createobject("MKVTagCOM.MKVTagManager");
The COM class returns node classes with GetRootNodeByIndex() and FindNode() use these returned class objects to access the particular node.
Note: the returned node classes are only valid until the instance is valid or the specific node is not deleted or new tags are loaded.
The COM class has the same interface as the standalone DLL version (so see the 'Tutorial DLL' on usage) the only exception is that the GetRootNodeByIndex() returns an 'IMKVTagRootNode' class and the GetNodeByIndex() returns an 'IMKVTagNode' class that can be used to recursively access the MKV tag hierarchy.
Useful information
|